package com.tarrant.servlet;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.tarrantcounty.entity.Employee;

/**
 * Servlet implementation class EmployeeCreateServlet
 */
@WebServlet("/createEmp")
public class EmployeeCreateServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String ename = request.getParameter("empname");
		
		// validate ename!
		Employee emp = new Employee (ename, 1000);
		HttpSession session = request.getSession(true);
		
		session.setAttribute("currentEmployee", emp);
		
		response.sendRedirect("payemp.jsp");
		
	
	}

}
